import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/Login/index.vue')
    },
    {
      path: '/',
      name: 'layout',
      component: () => import('@/views/Layout/index.vue'),
      redirect: '/home',
      children: [
        {
          path: '/home',
          name: 'home',
          component: () => import('@/views/Home/index.vue')
        },
        {
          path: '/playList/:id',
          name: 'playList',
          component: () => import('@/views/PlayList/index.vue')
        },
        {
          path: '/search/:name',
          name: 'search',
          component: () => import('@/views/Search/index.vue')
        },
        {
          path: '/recommendSongList',
          name: 'recommendSongList',
          component: () => import('@/views/recommendSongList/index.vue')
        },
        {
          path: '/myPlayList',
          name: 'myPlayList',
          component: () => import('@/views/MyPlayList/index.vue')
        },
        {
          path: '/playHistory',
          name: 'playHistory',
          component: () => import('@/views/PlayHistory/index.vue')
        },
        {
          path: '/cloudDisk',
          name: 'cloudDisk',
          component: () => import('@/views/CloudDisk/index.vue')
        },
        {
          path: '/musicVideo',
          name: 'musicVideo',
          component: () => import('@/views/MusicVideo/index.vue')
        },
        {
          path: '/musicVideo/detail/:id',
          name: 'musicVideoDetail',
          component: () => import('@/views/MusicVideo/components/MusicVideoDetail.vue')
        }
      ]
    }
  ]
})

export default router
